package com.fk.his.web.controller;

import com.alibaba.cola.dto.MultiResponse;
import com.alibaba.cola.dto.SingleResponse;
import com.rickie.api.IBizNoRuleService;
import com.rickie.dto.data.BizNoRuleCO;
import com.rickie.dto.data.BizNoRuleAddCmd;
import com.rickie.dto.data.BizNoRuleQuery;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * <p>
 * 业务编码控制器
 * <p>
 * 示例代码
 * <pre>
 * </pre/>
 *
 * @author InHome
 * @version BME V100R001 2023/03/28
 * @since BME V100R001C40B104
 */
@RestController
@RequestMapping("/rule")
public class BizNoRuleController {

    @Resource
    private IBizNoRuleService bizNoRuleFacade;


    /**
     * 增加业务规则
     *
     * @param bizNoRuleCmd 增加业务规则的请求对象
     */
    @PostMapping("/add")
    public SingleResponse<BizNoRuleCO> addBizNoRule(@RequestBody @Valid BizNoRuleAddCmd bizNoRuleCmd) {
        return bizNoRuleFacade.save(bizNoRuleCmd);
    }

    /**
     * 获取业务编码列表
     *
     * @param bizNoRuleQuery 查询条件
     * @return
     */
    @GetMapping("/list")
    public MultiResponse<BizNoRuleCO> getBizNoRuleList(@RequestBody @Valid BizNoRuleQuery bizNoRuleQuery) {
        return MultiResponse.of(bizNoRuleFacade.findWithPage(bizNoRuleQuery));
    }
}